codeblitz001: Get to know your new labmate,
GithubIn the Landscape Ecology Lab, we study disturbance, forest dynamics, integrating field work and remote sensing. Much of this work involves coding, analyzing large datasets, developing reproducible workflows, and building methods that can be shared across projects. Coding is often learned and practiced in isolation. Our Code Blitzes create a space to code together, so we can sharpen skills, solve problems as a team, and strengthen the collaborative spirit of our lab.
Provide training in collaborative coding skills in R
and GitHub that improve reproducibility and teamwork across lab
projects.
Strengthen our lab network by creating shared experiences for junior and senior members.
Advance research capacity in disturbance ecology, LiDAR, and remote sensing through shared tools, workflows, and problem-solving.
In this first Code Blitz, we’ll focus on getting everyone set up and making their first contributions in GitHub. By the end of the session, each lab member will have contributed to a shared project that forms the foundation of a collaborative website.
AI generated image depecting what our group is up to today. Aren’t we a handsome group?
For this code blitz, we’ll each contribute portions of a lab website that features our favorite field sites. But you can also do you favorite vacation, hiking spot, etc. By the end of the blitz, you will
Specifically we will
Prior to our first meeting, please complete the following tasks:
Setup a Github account. Note that you may have to verify your account and possibly setup a dual-authentication. You can actually do this in your DUO app that you use for Jones Center authentication
Make sure you have RGUI and Rstudio
installed on your computer. You can find some instructions here.
install gitbash on your computer. In Windows open
the Command Prompt by clicking start and typing cmd. When
the command prompt is open type
winget install --id Git.Git -e --source winget
We’ll all complete the work, but let’s still work in groups so that you have a go-to team to ask questions. We will create Teams Rooms for you to meet privately, share code, and answer questions. Go to your team first to ask questions. If the issue persists, bring it to the larger group.
| Team name | Room Name | Person 1 | Person 2 | Person 3 | Person 4 |
|---|---|---|---|---|---|
| Ferns | Room 1 | Jeff | Leah | Latonya | Jingting? |
| Saplings | Room 2 | Khanh | Tanner | Carly | Nathan |
| Rhizomes | Room 3 | Nicole | Morne | Ramp Fellow | Lain |
For this code blitz, we’ll each contribute portions of a lab website that features our favorite field sites. But you can also do you favorite vacation, hiking spot, etc. By the end of the blitz, you will
The instructions are intentionally vague as this is the first time trying this! We’ll try to answer specific questions in person but you should
Click the green Code button. In the Local drop-down, copy the HTTPS link.
In RStudio, choose File/New Project/Version Control/Git. Paste the repo URL and the project directory name will auto-populate. Save the project wherever you usually save your Rprojs.
jeff)Make sure you’re in the right Rproj (indicated by the blue R cube at the top right corner). In the Git tab, click on the purple icon to create your branch. Once your branch is created, you should be automatically switched to work on it. Double check to make sure the branch name indicates so.
Name your branch with your name or something we can easily recognize. Don’t change anything else.
jeff.Rmd) document to make
a profile.Stage your commit by checking the box (1), then click the Commit button
Write the commit message (without a message, the system won’t let you commit) (1), click the Commit button (2), then click the Push button (3) to commit the changes from your local to remote repo
main which we
will mergeAfter you have successfully committed and pushed, there should be an automatic notification in yellow in GitHub telling you to Compare & pull request. Click on it, or manually create a PR by clicking on the Pull requests tab above the repo.
Be sure to set base: main and compare: [your branch]. Option to modify your PR’s title and add a description. Click Create pull request once you are happy with everything.
# Name
## Biography
## Favorite field site
## Photo gallery
## Resources
## Map of field site
# NameYour name, duh, note the Header level 1, indicated
by a single #
## Biography##.img/
directory or link directly from a webpage. Specify a caption and adjust
the size of the image## Favorite field site## Photo gallery## Resources## CodeR code that creates a map of your
field site.{r warning=FALSE} library(leaflet) leaflet() %>% addTiles() %>% addMarkers(lng = -71.297210, lat = 44.055972, popup = "Barlett Experimental Forest")
dbh = c(35, 23, 12, NA, 8) # in cm
plot_area = 0.1 #in ha
R code, you can use the following
format, offset by three backticks ```. (See
khanh.Rmd for an example of formatting R codes in
Rmd.){r} myFunction = function(dbh, plot_area) { #my code return(basal_area) }
Within one week of today’s exercise complete the following tasks with an assigned partner.
Now that you’ve practiced committing to your own branch, we will try a common workflow: pull requests (PRs). A pull request is how you propose changes to a shared repository so others can review and approve them before merging back into the main branch.
BiographyFavorite field sitePhoto gallery.R code for basal area in a separate window.
Does it work for you? If not, suggest an edit